﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TTQT;
using TTQT.TTQT_Code;
using TTQT.TTQT_Code.Info;
using System.Data.SqlClient;
public partial class MainBaoCao : MasterControl
{
    private int _dayIndex = 0;
    private int _day1Index = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            LoadReportList();
        }
    }
    private void LoadReportList()
    {

        Report r = new Report();
        // Nếu là người dùng thuộc trung ương

        if (isRole("adminCN")) // la adminCN
        {
            ddlBaocao.Items.Clear();
            ddlBaocao.DataSource = r.GetbyUser(true, false, false, false);
            ddlBaocao.DataBind();
        }
        if (UserInfo.Pgd != 0 && (isRole("quychinh") || isRole("ksv"))) //là QC hoặc KSV PGD
        {
            ddlBaocao.Items.Clear();
            ddlBaocao.DataSource = r.GetbyUser(false, false, true, false);
            ddlBaocao.DataBind();
        }
        if (isRole("gdv")) // Nếu là gdv
        {
            ddlBaocao.Items.Clear();
            ddlBaocao.DataSource = r.GetbyUser(false, false, false, true);
            ddlBaocao.DataBind();
        }
        ddlBaocao.Items.Add(new ListItem("__________ Lựa chọn báo cáo ___________", "BC"));
        ddlBaocao.SelectedValue = "BC";
    }

    protected void ddlBaocao_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            content.Controls.Add(LoadControl(ddlBaocao.SelectedValue));
        }
        catch (Exception exx)
        {
            lblError.Text = exx.ToString();
        }
    }
}
